<!DOCTYPE html>
<html class=" js csstransforms3d">
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>文章发布-发布</title>
    <link rel="stylesheet" href="/static/css/base.css">
    <link rel="stylesheet" href="/static/css/page.css">
    <script type="text/javascript" src="/static/js/jquery.min.js"></script>
    <script type="text/javascript" src="/static/js/main.js"></script>
    <script type="text/javascript" src="/static/js/modernizr.js"></script>
    <script type="text/javascript" src="/static/js/jquery.selectui.js"></script>

    <script type="text/javascript" charset="utf-8" src="/static/js/utf8-jsp/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="/static/js/utf8-jsp/ueditor.all.min.js"></script>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
    <script type="text/javascript" charset="utf-8" src="/static/js/utf8-jsp/lang/zh-cn/zh-cn.js"></script>

    <link rel="stylesheet" type="text/css" href="/static/js/webuploader/webuploader.css">
    <link rel="stylesheet" type="text/css" href="/static/js/webuploader/demo.css">

    <script>
        $(function ($) {
            $("select").selectui({
                // 是否自动计算宽度
                autoWidth: true,

                // 是否启用定时器刷新文本和宽度
                interval: true
            });
        });
    </script>

    <link href="/static/js/utf8-jsp/themes/default/css/ueditor.css" type="text/css" rel="stylesheet">
    <script src="/static/js/utf8-jsp/third-party/codemirror/codemirror.js" type="text/javascript" defer></script>
    <link rel="stylesheet" type="text/css" href="/static/js/utf8-jsp/third-party/codemirror/codemirror.css">

</head>

<body style="background: rgb(246, 245, 250);">
<!--content S-->
<div class="super-content">

    <div class="superCtab">
        <div class="publishArt">
            <h4>发布文章</h4>
            <div class="pubMain">
                <a href="{% url 'App:main' %}" class="backlistBtn"><i class="ico-back"></i>返回列表</a>
                <form action="{% url 'ArticleManage:update' aid=aid cid=cid%}" method="post" enctype="multipart/form-data">
                    {% csrf_token %}
                    <input type="hidden" name="cid">{{ article.title }}
                    <h5 class="pubtitle">文章标题</h5>
                    <div class="pub-txt-bar">
                        <input type="text" class="shuruTxt" name="title" value="{{ article.title }}">{{ information }}
                    </div>
                    <h5 class="pubtitle">文章来源</h5>
                    <div class="pub-txt-bar">
                        <input type="text" class="shuruTxt" name="resource" value="{{ article.resource }}">
                    </div>
                    <h5 class="pubtitle">上传图片</h5>

                    <div class="Thumbnails clearfix">
                        <div class="Thumblist" id="preview">
                           <div class="Thumblistbg upload-img">
                            <input id="photo" type="file"  size="30" name="file">
                            <a href="javascript:;" class="Thumbbtn"><i class="ico-download"></i>上传图片</a>
                        </div>
{#                            <div class="Thumb_li">#}
{#                                <div class="bg" style="display: none;">#}
{#                                    <a href="javascript:" class="Thumb_delete" title="删除" data-index="0">删除</a>#}
{#                                </div>#}
{#                                <img src="/static/images/img-snt.jpg" class="upload_image">#}
{#                            </div>#}
                        </div>

                    </div>
{#                    <h5 class="pubtitle">视频地址</h5>#}
{#                    <div class="pub-txt-bar">#}
{#                        <input type="text" class="shuruTxt" placeholder="http://">#}
{#                    </div>#}
                    <h5 class="pubtitle">作者</h5>
                    <div class="pub-area-bar">
                        <textarea name="author" rows="" cols="3">{{ article.author }}</textarea>
                    </div>
                    <h5 class="pubtitle">文章内容</h5>
                    <div class="pub-area-bar">
                        <textarea name="contend" rows="" cols="3" id="editor">{{ article.contend }}</textarea>
{#                        <input type="hidden" id="article_content" name="article_content">#}
                    </div>
                    <div class="pub-btn">
                        <input type="submit" id="publish_article" value="发布" class="saveBtn">
                    </div>
                </form>
            </div>
        </div>

    </div>
    <!--main-->

</div>



<script type="text/javascript">
    // 添加全局站点信息
    var BASE_URL = '/webuploader';
</script>
<!--引入JS-->
{#<script type="text/javascript" src="/static/js/webuploader/webuploader.js"></script>#}
{#<script type="text/javascript" src="/static/js/webuploader/demo.js"></script>#}
<script type="text/javascript">

    //实例化编辑器
    //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
    var ue = UE.getEditor('editor',{
                    initialFrameHeight: 300,

    });


    function isFocus(e) {
        alert(UE.getEditor('editor').isFocus());
        UE.dom.domUtils.preventDefault(e)
    }

    function setblur(e) {
        UE.getEditor('editor').blur();
        UE.dom.domUtils.preventDefault(e)
    }

    {#function insertHtml() {#}
        {#var value = prompt('插入html代码', '');#}
    {#    UE.getEditor('editor').execCommand('insertHtml')#}
    {#}#}

    function createEditor() {
        enableBtn();
        UE.getEditor('editor');
    }

    {#function getAllHtml() {#}
    {#    alert(UE.getEditor('editor').getAllHtml())#}
    {#}#}

    function getContent() {
        var arr = [];
        arr.push("使用editor.getContent()方法可以获得编辑器的内容");
        arr.push("内容为：");
        arr.push(UE.getEditor('editor').getContent());
        alert(arr.join("\n"));
    }

    function setDisabled() {
        UE.getEditor('editor').setDisabled('fullscreen');
        disableBtn("enable");
    }

    function setEnabled() {
        UE.getEditor('editor').setEnabled();
        enableBtn();
    }



    function setFocus() {
        UE.getEditor('editor').focus();
    }

    function deleteEditor() {
        disableBtn();
        UE.getEditor('editor').destroy();
    }

    function disableBtn(str) {
        var div = document.getElementById('btns');
        var btns = UE.dom.domUtils.getElementsByTagName(div, "button");
        for (var i = 0, btn; btn = btns[i++];) {
            if (btn.id == str) {
                UE.dom.domUtils.removeAttributes(btn, ["disabled"]);
            } else {
                btn.setAttribute("disabled", "true");
            }
        }
    }

    function enableBtn() {
        var div = document.getElementById('btns');
        var btns = UE.dom.domUtils.getElementsByTagName(div, "button");
        for (var i = 0, btn; btn = btns[i++];) {
            UE.dom.domUtils.removeAttributes(btn, ["disabled"]);
        }
    }

    function getLocalData() {
        alert(UE.getEditor('editor').execCommand("getlocaldata"));
    }

    function clearLocalData() {
        UE.getEditor('editor').execCommand("clearlocaldata");
        alert("已清空草稿箱")
    }


    // 提交数据
    {#$("#publish_article").click(function () {#}
    {#    content = ue.getContent();#}
    {#    console.log(content);#}
    {#    $("#article_content").val(content);#}
    {#    $("form").submit()#}
    {#})#}
</script>

</body>
</html>